/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package centralehotel.dao;

import centralehotel.dao.interfaces.PaysDAOLocal;
import centralehotel.modele.Pays;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Mathieu
 */
@Stateless
public class PaysDAO implements PaysDAOLocal {
    @PersistenceContext
    private EntityManager em;

    public void create(Pays pays) {
        em.persist(pays);
    }

    public void edit(Pays pays) {
        em.merge(pays);
    }

    public void remove(Pays pays) {
        em.remove(em.merge(pays));
    }

    public Pays find(Object id) {
        return em.find(centralehotel.modele.Pays.class, id);
    }

    public List<Pays> findAll() {
        return em.createQuery("select object(o) from Pays as o").getResultList();
    }

}
